<template>
  <div class="avue-sidebar">
    <logo></logo>
    <el-scrollbar style="height:100%;">
      <!-- 选择App -->
      <el-select v-model="value" placeholder="请选择" style="margin-left: 1em;margin-top: 2em;" @change="change">
        <el-option
          v-for="item in options"
          :key="item.value"
          :label="item.label"
          :value="item.value"
          size='small'
        ></el-option>
      </el-select>

      <div v-if="validatenull(menu)" class="avue-sidebar--tip">{{$t('menuTip')}}</div>
      <el-menu
        unique-opened
        :default-active="nowTagValue"
        mode="vertical"
        :show-timeout="200"
        :collapse="keyCollapse"
      >
        <sidebar-item
          :menu="menu"
          :screen="screen"
          first
          :props="website.menu.props"
          :collapse="keyCollapse"
        ></sidebar-item>
      </el-menu>
    </el-scrollbar>
  </div>
</template>

<script>
import { mapState,mapGetters } from "vuex";
import logo from "../logo";
import sidebarItem from "./sidebarItem";
export default {
  name: "sidebar",
  components: { sidebarItem, logo },
  inject: ["index"],
  data() {
    return {
      value : 0,
      options: [
        {
          value: 0,
          label: "FishNovel",
        },
      ],
    };
  },
  created() {
    this.value = this.cheng
    this.index.openMenu(this.menuId);
  },
  computed: {
    ...mapState({
          cheng : state => state.user.ch
      }),
    ...mapGetters([
      "website",
      "menu",
      "tag",
      "keyCollapse",
      "screen",
      "menuId",
      "ch"
    ]),
    nowTagValue: function () {
      return this.$router.$avueRouter.getValue(this.$route);
    },
  },
  mounted() {},
  methods: {
    change(){
      this.index.changeObject(this.value)
    }
  },
};
</script>
<style lang="scss" scoped>
</style>

